var ns, toast, actionsheet, UIAlbumBrowser;
var app = new Vue({
    el: '#app',
    data: {
        ID:0,
        CompleteTime:'',
        CompleteUserName:'',
        DeductCount:0,
        DeductScore:0,
        CompleteDesc:'',
        IsRectification:false,
        QualityControlID:0,
        QualityCategoryName:'',
        QualitycontrolStatus:0,
        QualitycontrolStatusDesc:'',
        ImgList:[]
    },
    methods: {
        get_data: function() {
            var that = this;
            ns.post({
                ID: that.ID,
                action: 'getcheckplantaskdetail',
            }, function(succeed, data, err) {
                if (succeed) {
                    that.CompleteTime = data.data.CompleteTime;
                    that.CompleteUserName = data.data.CompleteUserName;
                    that.DeductCount = data.data.DeductCount;
                    that.DeductScore = data.data.DeductScore;
                    that.CompleteDesc = data.data.CompleteDesc;
                    that.IsRectification = data.data.IsRectification;
                    that.QualityCategoryName=data.data.QualityCategoryName;
                    that.QualitycontrolStatus=data.data.QualitycontrolStatus;
                    that.QualitycontrolStatusDesc=data.data.QualitycontrolStatusDesc;
                    that.QualityControlID=data.data.QualityControlID;
                    that.ImgList = data.data.ImgList;
                } else {
                    api.toast({
                        msg: err,
                        duration: 2000,
                        location: 'bottom'
                    });
                }
            });
        },
        do_openzhenggai:function(){
            var that=this;
            ns.openWin('qualitycontroldetail_frm', '任务详情',{
                id:that.QualityControlID
            })
        },
        img_browser: function(item) {
            var that = this;
            var imgurls = [];
            imgurls.push(item.SysFinalFilePath);
            imageBrowser.openImages({
                imageUrls: imgurls,
                showList: false,
                activeIndex: 0
            });
        },

    }
});

apiready = function() {
    ns = window.Foresight.Util;
    toast = new auiToast();
    actionsheet = new auiActionsheet();
    UIAlbumBrowser = api.require('UIAlbumBrowser');
    imageBrowser = api.require('imageBrowser');
    app.ID = api.pageParam.ID;
    app.get_data();
    // api.addEventListener({
    //     name: 'do_choose_ckproduct_complete'
    // }, function(ret, err) {
    //     if (ret) {
    //         app.get_product_list(ret.value.list);
    //     }
    // });
    api.addEventListener({
        name: 'reloadservicelist'
    }, function(ret, err) {
        app.get_data();
    });

}
